﻿package mortal.game.view.guild.redPack
{
    import Message.Game.*;
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class RedPackOpenPanel extends GSprite
    {
        private var _resultTxt:GTextFiled;
        private var _openRedPackBtn:GLoadingButton;
        private var _sRedEvnvelopInfo:SRedEnvelopeInfo;

        public function RedPackOpenPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.RedPackSimpleTxt_2, 115, 342, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.RedPackTxt_2, 102, 152, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.RedPackSimpleTxt_1, 123, 110, this));
            var _loc_1:* = GlobalStyle.textFormatLv.center();
            _loc_1.size = 16;
            this._resultTxt = UIFactory.gTextField("", 101, 354, 167, 40, this, _loc_1);
            this._openRedPackBtn = UIFactory.gLoadingButton(ResFileConst.RedPackOpenBtn, 143, 462, 131, 44, this);
            this._openRedPackBtn.configEventListener(MouseEvent.CLICK, this.openRedPack);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._openRedPackBtn.dispose(param1);
            this._openRedPackBtn = null;
            this._resultTxt.dispose(param1);
            this._resultTxt = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function openRedPack(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RedPackRob, this._sRedEvnvelopInfo.redId));
            return;
        }// end function

        public function updateType(param1:SRedEnvelopeInfo = null) : void
        {
            this._sRedEvnvelopInfo = param1;
            this._resultTxt.text = this._sRedEvnvelopInfo.totalMoney.toString();
            return;
        }// end function

    }
}
